package com.fanshuai.bitmap;

import com.fanshuai.bitmap.bitmap.BitMap;
import com.fanshuai.bitmap.bloomfilter.BloomFilter;

public class Main {
    public static void main(String[] args) {
        //testBitMap();
        testBloomFilter();
    }

    private static void testBitMap() {
        BitMap bitMap = new BitMap(1 << 20);

        int[] a = {2, 24, 5, 6, 29, 7, 2, 5, 11, 23, 45};
        for (int i : a) {
            bitMap.insert(i);
        }

        for (int i : a) {
            System.out.println(bitMap.exists(i));
        }
        bitMap.delete(7);
        System.out.println(bitMap.exists(7));

        System.out.println(bitMap.getAll());
    }

    private static void testBloomFilter() {
        BloomFilter bloomFilter = new BloomFilter();

        bloomFilter.add("aaa");
        bloomFilter.add("fanshuai");
        bloomFilter.add("linfangyi");

        boolean b = bloomFilter.contains("aaa");
        System.out.println(b);

        b = bloomFilter.contains("fanshuai");
        System.out.println(b);

        b = bloomFilter.contains("林芳伊");
        System.out.println(b);
    }


}
